package Service.Impl;

import Dao.ResourceMapper;
import Service.ResourceService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import domain.Resource;
import domain.ResourceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ResourceServiceImpl implements ResourceService {

    /*
            资源表 分页 + 多条件 查询
     */
    @Autowired
    private ResourceMapper resourceMapper;

    @Override
    public PageInfo<Resource> findAllResourceByPage(ResourceVO resourceVO) {

        // 分页查询
        PageHelper.startPage(resourceVO.getCurrentPage(), resourceVO.getPageSize());

        List<Resource> resource = resourceMapper.findAllResourceByPage(resourceVO);

        PageInfo<Resource> pageInfo = new PageInfo<>(resource);
        return pageInfo;
    }
}
